// Projectile (Bullet/Shell) Class
#pragma once
#include "GameObject.h"
#include <d3d9.h>
#include <d3dx9.h>

class Projectile : public GameObject
{
public:
    Projectile();
    virtual ~Projectile();

    bool Initialize(LPDIRECT3DDEVICE9 device, const D3DXVECTOR3& startPos, const D3DXVECTOR3& direction, float speed = 100.0f);
    void Update(float deltaTime) override;
    void Render(LPDIRECT3DDEVICE9 device) override;
    void Cleanup() override;

    // Projectile properties
    bool IsActive() const { return m_isActive; }
    void Deactivate() { m_isActive = false; }
    float GetDamage() const { return m_damage; }
    float GetLifetime() const { return m_lifetime; }

    // Environment
    void SetTerrain(class Terrain* terrain) { m_pTerrain = terrain; }

private:
    LPD3DXMESH m_pMesh;
    LPDIRECT3DTEXTURE9 m_pTexture;

    D3DXVECTOR3 m_velocity;
    float m_speed;
    float m_damage;
    float m_lifetime;        // Max flight time
    float m_currentLifetime;
    bool m_isActive;

    class Terrain* m_pTerrain;
};
